import { Entity, model, property } from '@loopback/repository';

@model()
export class Topic extends Entity {
  @property({
    type: 'number',
    id: true,
  })
  id?: number;

  @property({
    type: 'string',
    required: true,
  })
  title: string;

  @property({
    type: 'string',
  })
  description?: string;

  @property({
    type: 'date',
  })
  created?: string;

  @property({
    type: 'date',
    required: true,
  })
  lastUpdated: string;

  /**
   * 话题创建者id
   * @see User
   */
  @property({
    type: 'number',
    required: true,
  })
  creatorId: number;

  constructor(data?: Partial<Topic>) {
    super(data);
  }
}
